package me.zhengjie.sqlservice.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import me.zhengjie.mapper.WcsRetryPlcMapper;
import me.zhengjie.pojo.entity.WcsRetryPlc;
import me.zhengjie.sqlservice.WcsRetryPlcService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class WcsRetryPlcServiceImpl extends ServiceImpl<WcsRetryPlcMapper, WcsRetryPlc> implements WcsRetryPlcService {

    private final WcsRetryPlcMapper wcsRetryPlcMapper;

    @Override
    public boolean insert(WcsRetryPlc wcsRetryPlc) {
        return wcsRetryPlcMapper.insert(wcsRetryPlc) > 0;
    }

    @Override
    public List<WcsRetryPlc> selectFloor(String floor) {
        LambdaQueryWrapper<WcsRetryPlc> wcsRetryPlcLambdaQueryWrapper = new LambdaQueryWrapper<>();
        wcsRetryPlcLambdaQueryWrapper.eq(WcsRetryPlc::getFloor,floor);
        return wcsRetryPlcMapper.selectList(wcsRetryPlcLambdaQueryWrapper);
    }

    @Override
    public void deleteId(Integer id) {
        wcsRetryPlcMapper.deleteById(id);
    }
}
